package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * sky-take-out
 * com.sky.mapper
 *
 * @author Ablecisi
 * @version 1.0
 * 2025/4/4
 * 10:46
 */
@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户
     * @param openId 用户的openid
     * @return User
     */
    @Select("SELECT * FROM sky_take_out.user WHERE openid = #{openId}")
    User getUserByOpenId(String openId);

    /**
     * 插入用户
     * @param user 用户信息
     */
    void insert(User user);

    /**
     * 根据用户id查询用户
     *
     * @param userId 用户id
     * @return User
     */
    @Select("SELECT * FROM sky_take_out.user WHERE id = #{userId}")
    User getUserById(Long userId);
}
